import React from 'react'
import {Route, Routes,Navigate} from 'react-router-dom'
import Index from './views/Index'
import Login from './views/Login'
import Register from './views/Register'
import Home from './views/home/Home'
import Category from './views/home/Category'
import ShopCart from './views/home/ShopCart'
import Mine from './views/home/Mine'
import NotFound from './views/NotFound'
/*
  Routes:是路由规则对象的集合
  Route:是路由规则对象，该对象有如下常见属性
   path:路由的跳转路径
     注意：一级路由必须要以/开头
   element:要跳转到的目标组件，它的值是一个JSX，JSX中使用标签的形式引入组件对象
*/
export default function App() {
  return (
    <Routes>
      <Route path='/' element={<Index/>}>
         <Route index element={<Navigate to="home"></Navigate>}></Route>
         <Route path="home" element={<Home/>}></Route>
         <Route path='category' element={<Category/>}></Route>
         <Route path='shopcart' element={<ShopCart/>}></Route>
         <Route path='mine' element={<Mine/>}></Route>
         {/* <Route path='*' element={<NotFound/>}></Route> */}
      </Route>
      <Route path='/login' element={<Login/>}></Route>
      <Route path='/register' element={<Register/>}></Route>
      <Route path='*' element={<NotFound/>}></Route>
    </Routes>
  )
}
